import java.util.Scanner;

import Gui.MedicalRecordGUI;
import client.ConnectionClient;
/**
 * The main method of the client.
 * @author ic08jh7
 *
 */
public class ClientMain {

	/**
	 * Creates a client to which will establish a connection to the server.
	 * At address localhost and port 9999.
	 */
	public static void main(String[] args) {
		ConnectionClient con = new ConnectionClient("localhost", 9999);
		System.out.println(con.openConnection());
		Scanner scan = new Scanner(System.in);
		MedicalRecordGUI gui = new MedicalRecordGUI(con);

		while (true) {
			try {
				Thread.sleep(1000);
				if (con.isConnected()) {
					System.out.println("Enter command: ");
					String toServer = scan.nextLine();

					String in = con.sendData(toServer);

					System.out.println(in);
					System.out.flush();
				}
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	}

}
